package com.chianghao.nio.core;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author ChiangHao
 * @date 2022/10/15 16:18
 */
public class NioThreadPool {


    private final static LinkedBlockingQueue<Runnable> executorQueue = new LinkedBlockingQueue<>();
    public final static ExecutorService pool = new ThreadPoolExecutor(
            Runtime.getRuntime().availableProcessors(),
            Runtime.getRuntime().availableProcessors()*3,
            60L,
            TimeUnit.SECONDS,
            executorQueue,
            r -> new Thread(r,"系统线程池")
    );

}
